package com.wx.tgp.designpattern.FactoryModePattern.SimpleFactory;

/**
 * 工厂对象类，复责new计算的实例
 */
public class FactoryOperation {

    private Operation operation;

    public Operation getOperation(double number1,double number2,String str){
        if("+".equals(str)){
            operation = new OperationSum(number1,number2);
        }else if("-".equals(str)){
            operation = new OperationSub(number1,number2);
        }else if("*".equals(str)){
            operation = new OperationMul(number1,number2);
        }else if("/".equals(str)){
            operation = new OperationDiv(number1,number2);
        }
        return operation;
    }

}
